package com.foreknow.view;

import com.foreknow.dao.AdminDao;
import com.foreknow.dao.impl.AdminDaoImpl;
import com.foreknow.model.Admin;
import com.foreknow.service.AdminService;
import com.foreknow.service.impl.AdminServiceImpl;

import java.sql.SQLException;

public class ViewDemo {
    public static void main(String[] args) {
        AdminServiceImpl service = new AdminServiceImpl();
        AdminDao adminDao = new AdminDaoImpl();
        service.setAdminDao(adminDao); //给service实现中的属性初始化，否则会出现空指针异常
        Admin admin = admin = service.isValidate("tom","123456");
        if(admin!=null) {
            System.out.println("登录成功......");
        }else {
            System.out.println("登录失败......");
        }
    }
}
